package com.xuexiang.xuidemo.slice.guideview;

import com.xuexiang.xuidemo.ResourceTable;
import com.xuexiang.xuidemo.ability.SplashAbility;
import com.xuexiang.xuidemo.slice.BaseAbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;
import ohos.agp.components.Component;

public class SplashAbilitySlice extends BaseAbilitySlice {
    protected void onStart(Intent intent) {
        super.onStart(intent);
    }

    @Override
    protected int getUIContentLayoutId() {
        return ResourceTable.Layout_ability_slice_guide_splash;
    }


    @Override
    protected int getTitleBarId() {
        return ResourceTable.Id_title_bar;
    }

    @Override
    protected void initComponents() {
        super.initComponents();
        findComponentById(ResourceTable.Id_guide_splash_anim).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                Intent secondIntent = new Intent();
                Operation operation = new Intent.OperationBuilder()
                        .withBundleName(getBundleName())
                        .withAbilityName(SplashAbility.class)
                        .build();
                secondIntent.setOperation(operation);
                secondIntent.setParam(SplashAbility.KEY_IS_DISPLAY,true);
                secondIntent.setParam(SplashAbility.KEY_ENABLE_ALPHA_ANIM,true);
                startAbility(secondIntent);
            }
        });
        findComponentById(ResourceTable.Id_guide_splash_noanim).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                Intent secondIntent = new Intent();
                Operation operation = new Intent.OperationBuilder()
                        .withBundleName(getBundleName())
                        .withAbilityName(SplashAbility.class)
                        .build();
                secondIntent.setOperation(operation);
                secondIntent.setParam(SplashAbility.KEY_IS_DISPLAY,true);
                secondIntent.setParam(SplashAbility.KEY_ENABLE_ALPHA_ANIM,false);
                startAbility(secondIntent);
            }
        });
    }

}
